package com.zhk.entry.proxy;



import com.zhk.entry.dao.impl.BaseDao;
import com.zhk.entry.mapper.UserMapperService;
import com.zhk.entry.mapper.impl.UserMapper;
import com.zhk.entry.model.User;

import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {

        UserMapperService userMapper = new UserMapper(new BaseDao());
        StuInvocationHandler stuInvocationHandler = new StuInvocationHandler(userMapper,null);

        UserMapperService o = (UserMapperService) Proxy.newProxyInstance(userMapper.getClass().getClassLoader(), userMapper.getClass().getInterfaces(), stuInvocationHandler);

        User user = new User();
        user.setId(5);
        user.setName("Tom");
        user.setAge(24);
        user.setAddress("保利叶宇");
        o.saveUser(user,null);
    }
}
